package com.totoro.domain;

import java.sql.Date;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

import com.totoro.domain.key.UserRoleKey;

/**
 * User-Role关联实体类
 */
@Entity
@Table(name = "user_role")
@IdClass(value = UserRoleKey.class)
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class UserRole extends BaseDomain {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	/*
	 * Field
	 */
	@Id
	private Role role;// 角色
	@Id
	private User user;// 用户
	private Date createDate;// 创建的时间

	// 构造空的构造器
	public UserRole() {
	}

	// 带参数的构造器
	public UserRole(Role role, User user, Date createDate) {
		super();
		this.role = role;
		this.user = user;
		this.createDate = createDate;
	}

	public Role getRole() {
		return role;
	}

	public void setRole(Role role) {
		this.role = role;
	}

	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	// 普通属性省略列名
	public Date getCreateDate() {
		return createDate;
	}

	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}

}